import axios from 'axios'
const service = axios.create({
    // baseURL: 'http://106.55.165.14:3000/api',
    baseURL: 'http://127.0.0.1:3000/api',
    timeout: 5000
})
// 验证token
service.interceptors.request.use(function (config) {
    let token = localStorage.getItem('token')
    try {
        token = JSON.parse(token) || ''
    } catch (err) {
        token = ''
    }
    if (token) {
        config.headers.Authorization = token

    }
    return config;
}, function (error) {
    return Promise.reject(error);
});

export default service
